{% extends 'layout/manage.html' %}
{% load static %}
{% block css %}
    <link rel="stylesheet" href="{% static 'tracer/css/project.css' %}">
{% endblock %}
{% block content %}
    <div class="container-fluid project">
        <a class="btn btn-primary" data-toggle="modal" data-target="#myModal"><i class="fa fa-plus-square"
                                                                                 aria-hidden="true"></i> 新建项目</a>
        <div class="panel panel-default" style="margin-top:20px">
            <div class="panel-heading"><i class="fa fa-star" aria-hidden="true"></i> 重点任务</div>
            <div class="panel-body">
                {% for star in project_dic.star %}
                    <div class="item">
                        <a href="{%url 'websass:dashboard'  project_id=star.value.id%}" class="title"
                           style="background-color: {{ star.value.get_p_color_display }};">{{ star.value.p_name }}</a>
                        <div class="info">
                            <div>
                                <a href="{%url 'websass:unproject_star' project_type=star.type project_id=star.value.id%}"><i class="fa fa-star" aria-hidden="true" style="color: #f0ad4e;"></i></a>
                                <span>{{ star.value.creator.username }}</span>
                            </div>
                            <div>
                                <i class="fa fa-user-o" aria-hidden="true"></i>
                                <span>{{ star.value.join_count }}</span>
                            </div>
                        </div>
                    </div>
                {% endfor %}

            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading"><i class="fa fa-tasks" aria-hidden="true"></i> 我的任务</div>
            <div class="panel-body">
                {% for my_project in project_dic.my %}
                    <div class="item">
                        <a href="{% url 'websass:dashboard' project_id=my_project.id %}" class="title"
                           style="background-color: {{ my_project.get_p_color_display }};">{{ my_project.p_name }}</a>
                        <div class="info">
                            <div>
                                <a href="{%url 'websass:project_star' project_type='my' project_id=my_project.id%}"><i class="fa fa-star" aria-hidden="true" style="color: #d5d5d5;"></i></a>
                                <span>{{ my_project.creator.username }}</span>
                            </div>
                            <div>
                                <i class="fa fa-user-o" aria-hidden="true"></i>
                                <span>{{ my_project.join_count }}</span>
                            </div>
                        </div>
                    </div>
                {% endfor %}
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading"><i class="fa fa-life-ring" aria-hidden="true"></i> 我参与任务</div>
            <div class="panel-body">
                {% for my_project in project_dic.join %}
                    <div class="item">
                        <a href="{% url 'websass:dashboard' project_id=my_project.id %}" class="title"
                           style="background-color: {{ my_project.get_p_color_display }};">{{ my_project.p_name }}</a>
                        <div class="info">
                            <div>
                                <a href="{%url 'websass:project_star' project_type='join' project_id=my_project.id%}"><i class="fa fa-star" aria-hidden="true" style="color: #d5d5d5;"></i></a>
                                <span>{{ my_project.creator.username }}</span>
                            </div>
                            <div>
                                <i class="fa fa-user-o" aria-hidden="true"></i>
                                <span>{{ my_project.join_count }}</span>
                            </div>
                        </div>
                    </div>
                {% endfor %}
            </div>
        </div>
    </div>
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">创建项目</h4>
                </div>
                <div class="modal-body">
                    <form id="addForm">
                        {% csrf_token %}
                        {% for field in form %}
                            <div class="form-group">
                                <label for=
                                               "{{ field.id_for_label }}">{{ field.label }}</label>
                                {{ field }}
                                <span class="error-msg"></span>
                            </div>
                        {% endfor %}
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
                    <button type="button" id="btnSubMint" class="btn btn-primary">确 定</button>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block js %}
    <script src="{% static 'tracer/js/project.js' %}"></script>
{% endblock %}